GBML manual / Audio

music_current

Whatever music_play/music_fade_to last targeted, even mid-fade - nothing-equivalent if silence is the target.

Syntax

music_current() -> song

Returns

song

Description

Whatever music_play/music_fade_to last targeted, even mid-fade - a nothing-equivalent value if silence is the current target. Useful mainly to avoid restarting a song that is already playing or already fading in, the same "is this already happening" check sound_playing gives sound effects.

It names where the music is heading, not what you can hear this instant: right after music_fade_to(song_b, ...) it already says song_b, while song_a is still fading out. To ask whether a fade is still going on, use music_fading; to ask how loud the music is right now, use music_volume.

Example

var m = music_current();

Reads whichever song is currently targeted into a local variable, to compare against before deciding whether to change it.

See also: music_fadingmusic_volumemusic_fade_to